package demo6;

public class Test {

    public static void main(String[] args) {
        Student student1 = new Student("zhangsan",17,80);
        Student student2 = new Student("lisi",19,100);

        System.out.println("根据年龄比较");

        AgeComparator ageComparator = new AgeComparator();

        if(ageComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

        System.out.println("根据成绩比较");

        ScoreComparator scoreComparator = new ScoreComparator();

        if(scoreComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

        System.out.println("根据姓名比较");

        NameComparator nameComparator = new NameComparator();
        if(nameComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

    }







    public static void main1(String[] args) {
        Student student1 = new Student("zhangsan",17,80);
        Student student2 = new Student("lisi",19,100);

        if(student1.compareTo(student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }
    }
}
